package com.cmy.mvvm.test.ui

import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.lifecycle.ViewModel
import com.cmy.framework.mvvm.mvvm.view.BaseActivity
import com.cmy.framework_base.common.UiState
import com.cmy.mvvm.test.databinding.ActivityMainBinding

class MainActivity : BaseActivity() {
    private val mViewModel by createViewModel<HomeViewModel>()

    private val binding by lazy { ActivityMainBinding.inflate(layoutInflater) }
    override fun registerInit() {
        registerUiChange(mViewModel.uiChange)
        refreshUiState(mViewModel.uiState)
        registerLoadSir(binding.root)
    }


    override fun getContentView(): View = binding.root

    override fun initView(bundle: Bundle?) {


    }

    override fun initData() {
//        mViewModel.run {
//            mNewsChannelsBean.observe(this@MainActivity) {
//                binding.tvContent.text = "${it.retCode}"
//            }
//
//            mFailureMsg.observe(this@MainActivity){
//                showFailure(it)
//            }
//        }


//        binding.tvContent2.setOnClickListener {
//            startActivity(Intent(this,DebugToolsActivity::class.java))
//        }
    }


}